package com.boboPlanet.user;

import cn.xuyanwu.spring.file.storage.EnableFileStorage;
import com.boboPlanet.comm.constance.CommInstance;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * Hello world!
 */
@SpringBootApplication
@Slf4j
@EnableAsync
@EnableFeignClients
@EnableFileStorage
@EnableKnife4j
@MapperScan(basePackages = "com.boboPlanet.user.mapper")
@EnableConfigurationProperties
@EnableTransactionManagement
@EnableDiscoveryClient
public class BoboPlanetUserMiddleServe {

    public static void main( String[] args ) {
        /**
         * 项目框架 集成logback 与nacos 自带的logback 冲突， nacos的logback 已经先于 项目启动，
         * logback 本身 在命名之后不允许二次修改contextName的名字
         */
        System.setProperty("nacos.logging.default.config.enabled", "false");

        ConfigurableApplicationContext context = SpringApplication.run(BoboPlanetUserMiddleServe.class);
        Environment environment = context.getBean(Environment.class);
        //String port = context.getEnvironment().getProperty(CommInstance.SERVER_PORT);

        log.info("波波星球 ===> 【用户中台】服务启动成功,port:" + environment.getProperty(CommInstance.SERVER_PORT) + "==> serverName:" + environment.getProperty(CommInstance.SERVER_NAME));
    }
}
